package p1000;

import java.util.Arrays;
import java.util.Scanner;

public class Main1106排序 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String str = scanner.nextLine();
            while (str.startsWith("5")) {
                str = str.substring(1);
            }
            String[] arr = str.split("5+");
            int[] ints = new int[arr.length];
            for (int i = 0; i < arr.length; i++) {
                ints[i] = Integer.parseInt(arr[i]);
            }

            Arrays.sort(ints);

            for (int i = 0; i < ints.length - 1; i++) {
                System.out.print(ints[i] + " ");
            }

            System.out.println(ints[ints.length - 1]);
        }
    }
} 